package com.cainaer.product.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cainaer.product.domain.ProductSku;
import com.cainaer.product.mapper.ProductSkuMapper;
import com.cainaer.product.service.IProductSkuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * SKU表 服务实现类
 * </p>
 *
 * @author Tina
 * @since 2020-09-11
 */
@Service
public class ProductSkuServiceImpl extends ServiceImpl<ProductSkuMapper, ProductSku> implements IProductSkuService {

    @Autowired
    private ProductSkuMapper productSkuMapper;


    /**
     * 新增商品SKU
     *
     * @param productSku
     * @return
     */
    @Override
    public Integer insertProductSku(ProductSku productSku) {
        return productSkuMapper.insert(productSku);
    }

    /**
     * 编辑商品SKU
     *
     * @param productSku
     * @return
     */
    @Override
    public Integer editProductSku(ProductSku productSku) {
        return productSkuMapper.updateById(productSku);
    }

    /**
     * 通过Id查询sku数据
     *
     * @param attributeId
     * @return
     */
    @Override
    public List<ProductSku> selectProductSkuByAttributeId(Long attributeId) {
        return productSkuMapper.selectProductSkuByAttributeId(attributeId);
    }

}
